<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>系统首页</title>
    <!-- 引入easyui框架 -->
    <link rel="stylesheet" type="text/css"
          href="../js/jquery-easyui-1.7.0/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css"
          href="../js/jquery-easyui-1.7.0/themes/icon.css">
    <link rel="stylesheet" type="text/css"
          href="../js/jquery-easyui-1.7.0/themes/color.css">
    <script type="text/javascript"
            src="../js/jquery-easyui-1.7.0/jquery.min.js"></script>
    <script type="text/javascript"
            src="../js/jquery-easyui-1.7.0/jquery.easyui.min.js"></script>

    <script type="text/javascript" src="../js/context-menu.js"></script>
    <script src="../js/jquery-easyui-1.7.0/jquery.cookie.min.js"></script>

    <style type="text/css">
        .top {
            height: 80px;
            border-bottom: 1px #95b8e7 solid;
            background-image: url(../images/top.jpg);
        }

        .button-tools {
            float: right;
            margin-right: 10px;
            margin-top: 40px;
        }

        .exit-system {
            float: right;
            margin-right: 10px;
            margin-left: 20px;
        }
    </style>

</head>
<body class="easyui-layout">
<script type="text/javascript">
    if (window.top != window.self) {
        window.top.location = "./index.html";
    }
</script>

<div id="cc" class="easyui-layout"
     style="width: 100%; heith: 100%; min-height: 600px;"
     data-options="fit:true">


    <div data-options="region:'north',border:false"
         style="overflow: hidden; height: 80px;">
        <div class="top">
            <div class="button-tools">
                <div class="exit-system">
                    <a id="exitSystem" target="_top" class="easyui-linkbutton"
                       href="../sys/admin/logout" data-options="iconCls:'icon-no'">安全退出</a>
                </div>
                <div class="exit-system">
                    <a id="modifyPassSystem" onclick="updatepass()"
                       class="easyui-linkbutton"
                       data-options="iconCls:'icon-large-clipart'">修改密码</a>
                </div>
                <div class="exit-system">
                    <div class="curUserInfo">
                        当前登录用户：<span id="loginUser"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div data-options="region:'west',title:'管理菜单',split:true"
         style="width: 200px;">
        <div id="aa" class="easyui-accordion"
             data-options="fit:true,border:false">

            <div title="基础管理" data-options="iconCls:'icon-save',selected:true"
                 style="overflow: auto; padding: 10px;">

                <a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
                   data-options="plain:true,"
                   onclick="open_menu('管理员管理','admin-manager.html')">管理员管理</a><br>

                <a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
                   data-options="plain:true,"
                   onclick="open_menu('商家管理','business-manager.html')">商家管理</a><br>

                <a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
                   data-options="plain:true,"
                   onclick="open_menu('餐品管理','food-manager.html')">餐品管理</a><br>

            </div>

            <div title="系统管理" data-options="iconCls:'icon-reload'"
                 style="padding: 10px;">
                <a href="javascript:void(0);" class="easyui-linkbutton"
                   data-options="plain:true" onclick="updatepass()">修改密码</a> <br>
                <a href="../sys/admin/logout" class="easyui-linkbutton"
                   data-options="plain:true">退出系统</a>
            </div>

        </div>
    </div>

    <div data-options="region:'center',border:false,plain:true">
        <div id="tt" class="easyui-tabs" data-options="fit:true"
             data-options="tools:'#tab-tools'">
            <div title="首页" style="text-align: center; font-size: 24px;">
                <p>欢迎来到饿了么后台管理系统</p>
            </div>
        </div>
    </div>

    <div id="tab-tools">
        <a href="javascript:void(0)" class="easyui-linkbutton"
           data-options="plain:true,iconCls:'icon-reload'" onclick="reload()"></a>
        <a href="javascript:void(0)" class="easyui-linkbutton"
           data-options="plain:true,iconCls:'icon-delete'" onclick="closecur()"></a>
    </div>

    <div id="mm" class="easyui-menu" style="width: 150px;">
        <div data-options="iconCls:'icon-reload'" id="refresh">刷新</div>
        <div class="menu-sep"></div>
        <div data-options="iconCls:'icon-delete0'" id="closecur">关闭当前</div>
        <div data-options="iconCls:'icon-delete0'" id="closeall">全部关闭</div>
        <div data-options="iconCls:'icon-delete0'" id="closeother">除此之外全部关闭</div>
        <div class="menu-sep"></div>
        <div data-options="iconCls:'icon-delete0'" id="closeright">当前页右侧全部关闭</div>
        <div data-options="iconCls:'icon-delete0'" id="closeleft">当前页左侧全部关闭</div>
    </div>

    <div data-options="region:'south',border:false,plain:true"
         style="height: 40px; text-align: center; font-size: 12px;">
        <p>Ken,&copy;2020-2021</p>
    </div>
</div>

<div id="win" class="easyui-window" title="修改密码"
     style="width: 400px; height: 260px;" closed="true"
     data-options="collapsible:false,minimizable:false,resizable:false,maximizable:false"
     buttons="#updatepass_dlg-buttons">
    <form id="updateForm" style="padding: 10px 20px 10px 40px;">
        <p>
            旧密码: <input name="opassword" style="width: 260px;"
                        class="easyui-passwordbox " prompt="请输入旧密码" required="true">
        </p>
        <p>
            新密码: <input name="npassword" style="width: 260px;"
                        class="easyui-passwordbox " prompt="请输入新密码" required="true">
        </p>
        <div id="updatepass_dlg-buttons"
             style="text-align: center; margin-top: 50px;">
            <a href="#" class="easyui-linkbutton" iconCls="icon-ok"
               onclick="updatePassword()">保存</a> <a href="#"
                                                    class="easyui-linkbutton" iconCls="icon-cancel"
                                                    style="margin-left: 50px;"
                                                    onclick="javascript:$('#win').dialog('close')">取消</a>
        </div>
    </form>
</div>

<script type="text/javascript">
    function open_menu(titleName, menuUrl) {
        if ($("#tt").tabs("exists", titleName)) {
            $("#tt").tabs("select", titleName);
        } else {
            $('#tt').tabs('add', {
                title : titleName,
                href : menuUrl,
                closable : true
            });
        }
    }

    $(function() {
        bindContextMenu('#tt');
        //jquery读取cookie中的用户名，并显示到页面中
        var skey = $.cookie('login_user');
        $("#loginUser").text(skey);
    });

    function updatepass() {
        $('#win').window('open');
    }

    function clearForm() {
        $('#updateForm').form('reset');
    }

    function updatePassword() {
        //使用ajax进行提交，
        $('#updateForm').form('submit', {
            url : '../sys/admin/udpass',
            onSubmit : function() {
                return $(this).form('validate');
            },
            success : function(result) {
                var result = eval('(' + result + ')');
                if (result.success) {
                    window.location.href = "../sys/admin/logout";
                }
            }
        });
    }
</script>

</body>
</html>